import {REQUEST_CONFIG} from "@/data/basic_data";
import request from '@/utils/request';

export function listData(query) {
  return request({
    url: `/system-set/params-manager/app/version${query}`,
    method: 'get',
  });
}

// 获取app版本设置模块列表
// app_type	number  app类型 1 安卓 2ios
export function appConfigListData(params) {
  return request({
    url: '/system-set/app-version/management',
    method: 'get',
    params
  })
}

// 创建app 管理
// /system-set/app-version/management
export function addAppManagement(data) {
  return request({
    url: '/system-set/app-version/management',
    method: 'post',
    data,
    headers: {
      "Content-Type": "multipart/form-data"
    }
  })
}

// 修改 app 管理
// /system-set/app-version/management/{id}
export function editAppManage(id, data) {
  return request({
    url: `/system-set/app-version/management/${ id }`,
    method: 'put',
    data,
    [REQUEST_CONFIG.PARSE]: false
  })
}

// 删除app管理表数据
// /system-set/app-version/management
export function delAppManagement(id) {
  return request({
    url: '/system-set/app-version/management',
    method: 'delete',
    data: { id }
  })
}


// 配置相关
// app设置信息列表列表
// 设置模块信息列表
export function appSetingListData(app_type, page = 1, perPag = 10) {
  return request({
    url: '/system-set/app-version/app-setting',
    method: 'get',
    params: { app_type, page, perPag }
  })
}

// 获取表格数据
/**
 * appTableData
 * @param app_type 类型  app类型 1 安卓 2ios
 * @param page        当前页数 可选
 * @param perPage   分页容量 可选
 * @returns {*}
 */
export function appTableData(app_type, page, perPage) {
  return request({
    url: '/system-set/app-version/version-setting',
    method: 'get',
    params: { app_type, page, perPage }
  })
}


// app 全局设置修改   配置页面的
export function appSettingEdit(id, data) {
  return request({
    url: `/system-set/app-version/app-setting/${ id }`,
    method: 'put',
    data
  })
}

// app 配置页面的  新增版本
// /system-set/app-version/version-setting
export function addAppVersionSetting(data) {
  return request({
    url: '/system-set/app-version/version-setting',
    method: 'post',
    data
  })
}

// app版本设置模块修改  app 配置页面的  编辑版本
// /system-set/app-version/version-setting/{id}
export function editAppVersion(id, data) {
  return request({
    url: `/system-set/app-version/version-setting/${id}`,
    method: 'put',
    data
  })
}

// app版本设置模块删除
// /system-set/app-version/version-setting
export function delAppVersion(id) {
  return request({
    url: '/system-set/app-version/version-setting',
    method: 'delete',
    data: { id }
  })
}


// 获取版本号, 自己处理表格数据.........
// 获取app版本设置模块列表
// app_type	number  app类型 1 安卓 2ios
// android_application_type
export function getVersionNumber(params) {
  return request({
    url: '/system-set/app-version/management',
    method: 'get',
    params
  })
}




